<?php
    class Main_Controller_Action extends Zend_Controller_Action
    {
        public function loadTemplates($section = 'default')
        {
            $baseUrl = $this->_request->getBaseUrl();
            $filename = TEMPLATES_PATH . '/template.ini';
            $configs = new Zend_Config_Ini($filename, $section);
            //file layout se duoc load
            $layout = $configs->layout;
            $templates_path = $configs->TemPath;
            $UrlTem = $baseUrl . $configs->UrlTem;
            $DirCss = $UrlTem . '/' . $configs->DirCss;
            $DirJs = $UrlTem . '/' . $configs->DirJs;
            $DirImg = $UrlTem . '/' . $configs->DirImg;
            $this->view->DirImg = $DirImg;
            
            if(count($configs->FileCss) > 0)
            {
                foreach($configs->FileCss as $value)
                {
                    $this->view->headLink()->appendStylesheet($DirCss . '/' . $value);
                }
            }
            
            if(count($configs->FileJs) > 0)
            {
                foreach($configs->FileJs as $value)
                {
                    $this->view->headScript()->appendFile($DirJs . '/' . $value);
                }
            }
            
            $option = array('layoutpath' => $templates_path, 'layout' => $layout);
            Zend_Layout::startMvc($option);
        }
    }